package com.example.togethermove.adapter;

import android.view.View;
import android.view.ViewGroup;

import androidx.viewpager.widget.PagerAdapter;

import java.util.List;

public class GuidePageAdapter extends PagerAdapter {
	List<View> listview;
	public GuidePageAdapter(List<View> listview){
		this.listview = listview;
	}
	
	@Override
	public int getCount() {
		if (listview != null) {
			return listview.size();
		}
		return 0;
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		container.removeView(listview.get(position
				% listview.size()));
	}

	@Override
	public Object instantiateItem(ViewGroup container, int position) {
		container.addView(listview.get(position % listview.size()));
		return listview.get(position % listview.size());
	}

}
